package com.xunshibao.action.info;

import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import org.springframework.validation.Validator;

import com.xunshibao.entity.info.TutorInfo;

public class TutorInfoValidator implements Validator {

    @Override
    public boolean supports(Class<?> clazz) {
        return clazz.equals(TutorInfo.class);
    }

    @Override
    public void validate(Object target, Errors errors) {
        TutorInfo info = (TutorInfo) target;
    }
    
    public void saveValidate(TutorInfo info, Errors errors) {
        if(info.getId() != null) {
            errors.rejectValue("id", "tutorinfo.id", "");
        }
        ValidationUtils.rejectIfEmpty(errors, "subject", "tutorinfo.subjectError", "");
        ValidationUtils.rejectIfEmpty(errors, "title", "tutorinfo.subjectError", "");
        ValidationUtils.rejectIfEmpty(errors, "feeType", "tutorinfo.subjectError", "");
        ValidationUtils.rejectIfEmpty(errors, "feeType", "tutorinfo.subjectError", "");
        ValidationUtils.rejectIfEmpty(errors, "feeType", "tutorinfo.subjectError", "");
        ValidationUtils.rejectIfEmpty(errors, "feeType", "tutorinfo.subjectError", "");
        ValidationUtils.rejectIfEmpty(errors, "feeType", "tutorinfo.subjectError", "");
    }

}
